import httpRequest from '@/utils/httpRequest'


export function getAllRole (data) {
  return httpRequest({
    url: httpRequest.adornUrl('/sys/role/select'),
    method: 'get',
    params: httpRequest.adornParams(data)
  })
}

export function getRoleList (data) {
  return httpRequest({
    url: httpRequest.adornUrl('/sys/role/list'),
    method: 'get',
    params: httpRequest.adornParams(data)
  })
}

export function deleteRole (ids, openDefultdata = true) {
  return httpRequest({
    url: httpRequest.adornUrl('/sys/role/delete'),
    method: 'post',
    data: httpRequest.adornData(ids, openDefultdata)
  })
}

export function roleInfoById (id) {
  return httpRequest({
    url: httpRequest.adornUrl(`/sys/role/info/${id}`),
    method: 'get',
    params: httpRequest.adornParams()
  })
}

export function roleInfoSave (data) {
  return httpRequest({
    url: httpRequest.adornUrl(`/sys/role/${!data.roleId ? 'save' : 'update'}`),
    method: 'post',
    data: httpRequest.adornData(data)
  })
}
